#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>

int compare(const void* a, const void* b)
{
    return *(int*)a - *(int*)b;
}

int minimumSum(int num) {
    int sum[4];
    for (int i = 0; i < 4; i++)
    {
        sum[i] = num % 10;
        num /= 10;
    }
    qsort(sum, 4, sizeof(sum[0]), compare);
    return (sum[0] + sum[1]) * 10 + sum[2] + sum[3];
}

int main()
{

	return 0;
}